<template>
  <div class="pass">
    <!-- 通行证管理 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>人员登记信息</el-breadcrumb-item>
    </el-breadcrumb>
  </div>

  <el-card>
    <div class="height">
      <el-form :label-position="labelPosition" label-width="80px">
        <!-- <el-form-item label="用户id">
            <el-input v-model="formInline.baseid"></el-input>
          </el-form-item> -->
        <el-form-item label="姓名">
          <el-input v-model="formInline.uname"></el-input>
        </el-form-item>

        <el-form-item label="身份证号">
          <el-input v-model="formInline.idCard"></el-input>
        </el-form-item>

        <el-form-item label="体温">
          <el-input v-model="formInline.outtem"></el-input>
        </el-form-item>

        <el-form-item label="进入时间">
          <el-date-picker
            v-model="formInline.intime"
            type="datetime"
            placeholder="选择日期时间"
            align="right"
            :picker-options="pickerOptions"
          >
          </el-date-picker>
        </el-form-item>

        <el-form-item label="电话号码">
          <el-input v-model="formInline.phone"></el-input>
        </el-form-item>

        <el-form-item label="出去时间">
          <el-date-picker
            v-model="formInline.outtime"
            type="datetime"
            placeholder="选择日期时间"
            align="right"
            :picker-options="pickerOptions"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="formInline.note"></el-input>
        </el-form-item>

        <div class="button">
          <el-form-item>
            <el-button color="red" @click="submitForm">保存</el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="back">返回</el-button>
          </el-form-item>
        </div>
      </el-form>
    </div>
  </el-card>
</template>
  
    <script>
import { postAddPersonApi } from "../api/index1.js";
import { ElMessage } from "element-plus";
export default {
  data() {
    return {
      formInline: {
        outtem: "",
        uname: "",
        outtime: "",
        intime: "",
        note: "",
        idCard: "",
        phone: "",
      },
    };
  },
  methods: {
    back() {
      this.$router.push({
        path: "../views/userRegister", //要跳转的页面的路由
      });
    },
    //查询
    onSubmit() {
      console.log("submit!");
    },
    //添加数据
    submitForm() {
      postAddPersonApi(this.formInline).then((res) => {
        console.log(res);
        this.formInline = {};
        // 2.提示用户添加成功
        if (res.code == 20000) {
          ElMessage({
            message: "添加成功",
            type: "success",
          });
        }
        //   this.$router.back()
        this.$router.push("../views/userRegister");
        // this.passList = res.data.data;

      });
    },
    // changeStatus(id, status) {
    //   console.log(id + status);

    //   let obj = {
    //     id: id,
    //     status: status,
    //   };
    //   changePassStatusApi(obj).then((res) => {
    //     console.log(res);
    //     if (res.code == 20000) {
    //       this.getPassList();
    //       ElMessage({
    //         message: "更新成功",
    //         type: "success",
    //       });
    //     }
    //   });
    // },
  },
};
</script>
  
    <style lang="less" scoped>
.el-form {
  width: 800px;
}

.notice {
  margin-top: 10px;
  font-weight: bold;
}

.height {
  margin-top: 20px;
}

.height {
  line-height: 10px;
}

.el-input {
  width: 220px;
}

.el-card {
  margin-top: 10px;
}

.button {
  display: flex;
}
</style>
  